using System;
using System.Drawing;
using System.IO;
using System.Net;
using System.Net.Mail;
using System.Web;

namespace DotNet_Common
{
    public static class Msg
    {
		public static bool SendMail(string to,string sub,string txt)
		{
			try
			{
				DateTime d1 = DateTime.Now;
				string from = "yuan.jing@jiaboo.com";
				MailMessage mail = new MailMessage(from, to, sub, txt);
				DateTime d2 = DateTime.Now;
				SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
				client.Credentials = new NetworkCredential("yuan.jing@jiaboo.com", "wocaode");
				DateTime d3 = DateTime.Now;
				client.EnableSsl = true;
				client.Send(mail);
				DateTime d4 = DateTime.Now;
				//HttpContext.Current.Response.Write();
			}
			catch(Exception e)
			{
				throw new Exception(e.Message);
			}
			return true;
		}


		public static void SendSms(string num,string txt)
		{
			string url = "http://211.155.23.205/isapi.dll?SendSms&AgentID=9655007&PassWord=8888&phone=" + num + "&msg=" + txt + "&sendtime=0";

			WebClient c = new WebClient();
			//c.OpenRead("http://www.baidu.com");
		}
	}
}
